<!doctype html>
<jsp:directive.page import="com.cn.ccp.bean.UserBean" />
<%@page contentType="text/html;charset=UTF-8"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="https://ajax4jsf.dev.java.net/ajax" prefix="a4j"%>
<html>
<f:view>
<f:loadBundle var="messages" basename="messages"></f:loadBundle>
<head>
<meta charset="utf-8">
<title><h:outputText value="#{messages['system_title']}" /></title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta name="description" content="">
    <meta name="author" content="">

    <!-- styles -->
    <link href="<%=request.getContextPath()%>/css/bootstrap.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/bootstrap-responsive.css" rel="stylesheet">
    <link href="<%=request.getContextPath()%>/css/custom.css" rel="stylesheet">
    <!--[if lt IE 9]>
      <script src="../js/html5.js"></script>
    <![endif]-->
    <!-- Fav and touch icons -->
    <link rel="apple-touch-icon-precomposed" sizes="144x144" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-144-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="114x114" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-114-precomposed.png">
    <link rel="apple-touch-icon-precomposed" sizes="72x72" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-72-precomposed.png">
    <link rel="apple-touch-icon-precomposed" href="<%=request.getContextPath()%>/images/icon/apple-touch-icon-57-precomposed.png">
    <link rel="shortcut icon" href="<%=request.getContextPath()%>/images/icon/favicon.png">
    <%
		UserBean users = (UserBean) session.getAttribute("userBean");
			if ((users == null) || (users.getUserName().equals(""))) {
	%>
		<jsp:forward page="../sessionInvalid.jsp" />
	<%
	}
	%>
<style>
.firstColumn { 
     width: 12%; 
     text-align: center; 
}
.secondColumn {
     width: 60%; 
     text-align: right; 
}
.thirdColumn { 
     width: 50px; 
     text-align: left; 
}
.fourColumn { 
     width: 30px; 
     text-align: left; 
}
.fiveColumn { 
     width: 30px;  
     text-align: left; 
}
</style>	
	
</head>

<body class="bg-white" style="overflow-x:hidden;">
	<a id="viewDiv"></a>	
	<h:form id="formid">
		<div class="row page-head">
			<h3 class="page-title">
				<i class="n-icon-selection  n-icon-black"></i><h:outputText value="#{messages['pages_bbs_title']}"/>&nbsp;&gt;&nbsp;<b><h:outputText value="#{messages['label_list']}" /></b>
			</h3>
		</div>
		<div style="margin-left: 20px;margin-right: 20px">
			<h:commandButton value="#{messages['pages_bbs_btn_send_bbs']}" styleClass="btn btn-success" action="add"></h:commandButton>
			<div>
				<h:dataTable id="listtableinfo"
					value="#{courseForumAction.list}" var="roles" cellpadding="2"
					cellspacing="1" styleClass="table table-hover" >
					<h:column>
						<f:facet name="header">
							<h:outputText value="#"></h:outputText>
						</f:facet>
						<h:outputText value="#{roles.index}"></h:outputText>
					</h:column>
					
					<h:column>
						<f:facet name="header">
							<h:outputText value="#{messages['label_title']}"></h:outputText>
						</f:facet>
						<h:commandLink action="#{courseForumReplyAction.showContent}" styleClass="text-info">
							<h:outputText value="[#{roles.courseName}]#{roles.title}"></h:outputText>
							<f:param name="id" value="#{roles.id}" />
						</h:commandLink>
					</h:column>
					
					<h:column >
						<f:facet name="header">
							<h:outputText value="#{messages['pages_bbs_title_author']}"></h:outputText>
						</f:facet>
						<h:outputText value="#{roles.userName}"></h:outputText>
					</h:column>
					
					
					<h:column >
						<f:facet name="header">
							<h:outputText value="#{messages['pages_bbs_title_reply']}/#{messages['pages_bbs_title_selec']}"></h:outputText>
						</f:facet>
						<h:outputText value="#{roles.replyTimes}/#{roles.seeTimes}"></h:outputText>
					</h:column>
					
					<h:column >
						<f:facet name="header">
							<h:outputText value="#{messages['pages_bbs_title_last_time']}"></h:outputText>
						</f:facet>
						<h:outputText value="#{roles.updateTime}"></h:outputText>
					</h:column>
					
					<h:column>
						<f:facet name="header">
							<h:outputText value=""></h:outputText>
						</f:facet>
						<a4j:commandLink action="#{courseForumAction.deleteContent}"  rendered="#{roles.showDelete}"
							reRender="listtableinfo" styleClass="text-error"
							onclick="if(!confirm('#{messages['label_delete_sure']}？')){return false;}">
							<h:outputText value="#{messages['btn_delete']}" ></h:outputText>
							<f:param name="id" value="#{roles.id}" />
						</a4j:commandLink>
						<h:outputText></h:outputText>
					</h:column>
					
				</h:dataTable>
				
				<h:panelGrid columns="2" styleClass="pagination pagination-right" style="align:right" >
					<h:panelGrid columns="4" >
						<a4j:commandLink action="#{courseForumAction.firstPage}" styleClass="icon-fast-backward"  reRender="listtableinfo"></a4j:commandLink>
						<a4j:commandLink action="#{courseForumAction.provPage}" styleClass="icon-backward" reRender="listtableinfo"></a4j:commandLink>
						<a4j:commandLink action="#{courseForumAction.nextPage}" styleClass="icon-forward" reRender="listtableinfo"></a4j:commandLink>
						<a4j:commandLink action="#{courseForumAction.lastPage}" styleClass="icon-fast-forward" reRender="listtableinfo"></a4j:commandLink>
					</h:panelGrid>
					<h:panelGroup>
						<a4j:outputPanel ajaxRendered="true">
							<h:inputText value="#{courseForumAction.currentPage}" size="3" styleClass="input" style="width:20px"></h:inputText>
							<h:outputText value="/#{courseForumAction.countPage}#{messages['label_page']}"></h:outputText>
		
							<a4j:commandLink action="#{courseForumAction.goCurrentPage}"
								reRender="listtableinfo">
								<h:graphicImage value="../../images/BtnPageGo.gif"></h:graphicImage>
							</a4j:commandLink>
							<h:outputText value="#{messages['label_all']}#{courseForumAction.itemCount}#{messages['label_count']}"></h:outputText>
						</a4j:outputPanel>
					</h:panelGroup>
				</h:panelGrid>
			</div>
		</div>
	</h:form>
	<script src="<%=request.getContextPath()%>/js/jquery-1.8.3.min.js"></script>
	<script src="<%=request.getContextPath()%>/js/bootstrap.js"></script>
	<script>
	$(document).ready(function() {
		//document.getElementById('viewDiv').scrollIntoView();
	});
	</script>
</body>
</f:view>
</html>
